﻿using UnityEngine;
using System.Collections;

public class ItemSpawner : MonoBehaviour {
	public GameObject createPrefab;
	public Transform itemSpawnPoint;
	
	public Color[] colorsArray;
	
	// Update is called once per frame
	void Update () {
		if(Input.GetKey("c")){
			GameObject createdCrate2 = (GameObject)Instantiate(
				createPrefab,
				itemSpawnPoint.position,
				itemSpawnPoint.rotation);
			
			int randomInt = Random.Range(0,colorsArray.Length);
			
			createdCrate2.renderer.material.color = colorsArray[randomInt];
		}
	}
}
